﻿// Models/UserAnswer.cs - 扩展 UserAnswer 模型（如果需要保存答案文字描述）

using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

using WebApplication1.Models;

/// <summary>
/// 用户答案实体类
/// </summary>
[Table("UserAnswers")]
public class UserAnswer
{
    /// <summary>
    /// 答案ID
    /// </summary>
    [Key]
    public int AnswerId { get; set; }

    /// <summary>
    /// 结果ID
    /// </summary>
    [Required]
    public int ResultId { get; set; }

    /// <summary>
    /// 试题ID
    /// </summary>
    [Required]
    public int QuestionId { get; set; }

    /// <summary>
    /// 用户答案（序号）
    /// </summary>
    [Display(Name = "用户答案")]
    public string Answer { get; set; }

    /// <summary>
    /// 用户答案的文字描述
    /// </summary>
    [Display(Name = "用户答案描述")]
    public string AnswerText { get; set; }

    /// <summary>
    /// 是否正确
    /// </summary>
    [Display(Name = "是否正确")]
    public bool IsCorrect { get; set; }

    /// <summary>
    /// 得分
    /// </summary>
    [Display(Name = "得分")]
    public int Score { get; set; }

    /// <summary>
    /// 该题的正确答案（用于存储考试时打乱顺序后的正确答案序号）
    /// </summary>
    [Display(Name = "正确答案")]
    public string CorrectAnswer { get; set; }

    /// <summary>
    /// 正确答案的文字描述
    /// </summary>
    [Display(Name = "正确答案描述")]
    public string CorrectAnswerText { get; set; }

    /// <summary>
    /// 考试结果
    /// </summary>
    public virtual ExamResult ExamResult { get; set; }

    /// <summary>
    /// 试题
    /// </summary>
    public virtual Question Question { get; set; }
}